<template>
  <uni-popup ref="inputDialogRef" type="dialog">
    <uni-popup-dialog ref="inputClose"  mode="input" title="修改手机号" :value="form.phone"
                      :before-close="true" placeholder="请输入输入手机号" @confirm="confirm"></uni-popup-dialog>
  </uni-popup>
</template>
<script setup>

const inputDialogRef = ref()
const form = ref({
  phone: ''
})
const open=()=>{
  inputDialogRef.value.open()
}
const close=()=>{
  inputDialogRef.value.close()
}

const confirm= async (e)=>{
  if(!e){
    qly.dialog.toast({
      title: '请输入手机号'
    })
    return
  }
  const res=await qly.api.user.userupdate({
    phone: e
  })
  if (res.code===1) {
    qly.dialog.toast({
      title: '修改成功'
    })
    close()
  } else {
    qly.dialog.apiError(res).catch()
  }
}

defineExpose({
  open
})
</script>
<style scoped lang="scss">

</style>